<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="include/base.jsp" %>

<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<title>凯盛项目管理系统</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
	<link href="select2/select2.css" rel="stylesheet"/>
	<style type="text/css">
		.container .row ul li .link{
			padding: 0px;
			margin: 0px;
			display: inline;
			color: #fff;
		}
		.container .row ul li .link:hover{
			text-decoration: none;
			color: #fff;
			background-color: #0068CD;
		}
	</style>
</head>
<body class="body">
	
	<%--top --%>
	<%@include file="include/top.jsp"  %>
	
	<div class="container" style="font-size:14px">
	  <div class="row">
	    <div class="span3">
	  		<%--left --%>
	  		<%@include file="include/left.jsp" %>
	  		
		</div>
		<div class="span9">
		  <form action="modifyProject.jspx" method="post" class="form-horizontal">
        <fieldset>
          <legend>修改项目</legend>
          <div class="control-group">
            <label class="control-label" for="input01">项目名称</label>
            <div class="controls">
              <input type="text" name="projectName" value="${requestScope.project.name}" class="span5" id="input01" x-webkit-speech="undefined">
            </div>
          </div>
          <div class="control-group">
            <label class="control-label" for="input01">项目描述</label>
            <div class="controls">
              <textarea name="desc" class="span5" rows="4">${requestScope.project.desc}</textarea>
            </div>
          </div>
          <div class="control-group">
            <label class="control-label" for="multiSelect">负责人</label>
            <div class="controls">
              <select name="principal" id="multiSelect"><!--负责人-->
              	<c:forEach items="${requestScope.emplist}" var="employee">
              		<c:choose>
              			<c:when test="${requestScope.principalId==employee.id}">
			                <option selected="selected" value="${employee.id}">${employee.username}</option>
              			</c:when>
              			<c:otherwise>
			                <option value="${employee.id}">${employee.username}</option>
              			</c:otherwise>
              		</c:choose>
              	</c:forEach>
              </select>
            </div>
          </div>
          <div class="control-group">
            <label class="control-label" for="input01">项目成员</label>            
            <div class="controls">
            	<%-- <div>原有成员：
            		<c:forEach items="${requestScope.EmpProList} var="empPro">
            			${empPro.username}
            		</c:forEach>
            	</div> --%>
              <!-- 使用Select2插件 -->
              <select id="e2_2" name="members" multiple="multiple" style="width:400px">
              	<c:forEach items="${requestScope.emplist}" var="employee">
	                <option value="${employee.id}">${employee.username}</option>
              	</c:forEach>
              	
              	<!-- 这样不太对 -->
			   <%--  <c:forEach items="${requestScope.emplist}" var="employee">
			    	<c:forEach items="${requestScope.EmpProList}" var="empPro">
			    		<c:choose>
			    			<c:when test="${empPro.employeeid==employee.id}">
				                <option selected="selected" value="${employee.id}">${employee.username}</option>
			    			</c:when>
			    		</c:choose>
			    	</c:forEach>
			        <option value="${employee.id}">${employee.username}</option>
              	</c:forEach> --%>
			  </select>
			  
            </div>
          </div>
          
          <div class="form-actions">
            <button type="submit" class="btn btn-primary">保存</button>
            <button id="back" type="button" class="btn">返回</button>
          </div>
        </fieldset>
      </form>         
          	
		</div>
	  </div>
	</div>
	
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script src="select2/select2.js"></script>
	<script type="text/javascript">
        $(document).ready(function() {
        	$("#e2_2").select2({
			    //allowClear: true
			});
			$("#back").click(function(){
				location.href="project.jspx";
			});
        });
	</script>
</body>
</html>